<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 第一种场景
        function foo() {
            console.log(this.age); //undefined
        }
        foo();
        //第二种场景
        var age = 100;
        var user = {
            name: "张三",
            age:27,
            say: function () {
                console.log(this.age);
            }
        }
        user.say();

        var bar = user.say;
        console.log(bar);
        bar();
    </script>
</body>

</html>